package algorithm.sort.review3;

import java.util.Arrays;

public class Shell {
    public static void main(String[] args) {
        int[] arr = {8, 9, 1, 7, 2, 3, 5, 4, 6, 0};
        sort(arr);
    }
    public static void sort(int[] arr) {
        for (int i = arr.length / 2; i > 0; i /= 2) {
            for (int j = i; j < arr.length; j++) {
                int tmp = arr[j];
                int index = j;
                while (index - i >=0 && tmp < arr[index-i]){
                    arr[index] = arr[index - i];
                    index -= i;
                }
                arr[index] = tmp;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
